home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / GAMES / P_ROBO31 / LEADER.PR < prev    next >
Text File  |  1993-02-10  |  3KB  |  73 lines

  1. (**************************************************************************)
  2. (*                             W A R N I N G                              *)
  3. (*                                                                        *)
  4. (*  This Robot has NOT been designed to take advantage of the advanced    *)
  5. (*  features of P-ROBOTS, such as, Shields, Fuel, Teams or Obstructions.  *)
  6. (**************************************************************************)
  7.  
  8.   PROCEDURE LEADER;
  9.     { Based on a C-Robot by John Smolin }
  10.     { Strategy: Lead the target so robot can kill foes that move fast. }
  11.   VAR
  12.     x, orange, ox, dir, Range, rlead : Integer;
  13.  
  14.   BEGIN {Leader Main}
  15.     IF loc_x > 500
  16.     THEN drive(180, 100)
  17.     ELSE drive(0, 100);
  18.     x := 336;
  19.     rlead := 50;
  20.     REPEAT {Until Dead or Winner}
  21.       x := x+344;
  22.       Range := scan(x, 8);
  23.       WHILE (Range = 0) DO {find a target}
  24.         BEGIN
  25.           x := x+16;
  26.           Range := scan(x, 8);
  27.         END;
  28.       cannon(x, Range); {blast him!}
  29.       dir := x;
  30.       IF (Range > 200) THEN drive(x, 100); {follow him}
  31.       Range := scan(x, 8);
  32.       WHILE (Range > 0) DO
  33.         BEGIN 
  34.           IF (Range > 200) THEN
  35.             BEGIN 
  36.               ox := x;
  37.               orange := Range;
  38.               IF scan(x-4, 4) > 0 THEN x := x-4;
  39.               IF scan(x-2, 2) > 0 THEN x := x-2;
  40.               IF scan(x-1, 1) > 0 THEN x := x-1;
  41.               Range := scan(x, 10);
  42.               IF (Range > 0) THEN
  43.                 cannon(x+(x-ox)*Range DIV 200, Range+(Range-orange+rlead)*Range DIV 275);
  44.               IF (speed < 51) OR (((x-dir)*(x-dir)) > 400) THEN
  45.                 BEGIN
  46.                   dir := x;
  47.                   drive(x, 100);
  48.                   rlead := 25;
  49.                 END
  50.               ELSE rlead := 50;
  51.             END
  52.           ELSE
  53.             BEGIN
  54.               x := x+20;
  55.               WHILE (Range < 800) DO
  56.                 BEGIN
  57.                   x := x+340;
  58.                   Range := scan(x, 10);
  59.                   WHILE (Range = 0) DO {find him}
  60.                     BEGIN
  61.                       x := x+20;
  62.                       Range := scan(x, 10);
  63.                     END;
  64.                   cannon(x, Range); {blast him!}
  65.                   dir := x;
  66.                   IF (speed < 50) OR (Range > 200) THEN drive(x, 100); {follow him}
  67.                 END;
  68.             END;
  69.         END; 
  70.     UNTIL Dead OR Winner;
  71.   END; {Leader Main}
  72.  
  73.